using System;
using GameFramework.GameObjects;

namespace GameFramework.Diagnostics
{
    /// <summary>
    /// This game object show the accelerometer data on the screen.
    /// </summary>
    public class AccelerometerLabel : Label
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AccelerometerLabel"/> class.
        /// </summary>
        public AccelerometerLabel()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="AccelerometerLabel"/> class.
        /// </summary>
        /// <param name="fontName">The font name.</param>
        public AccelerometerLabel(string fontName)
        {
            FontName = fontName;
            Position = ScreenCenter;
        }

        /// <summary>
        /// Update the object.
        /// </summary>
        public override void Update()
        {
            Text = String.Format(
                        "Accelerometer:\n X:{0:0.000}\n Y:{1:0.000}\n Z:{2:0.000}",
                        Input.AccelerometerData.X,
                        Input.AccelerometerData.Y,
                        Input.AccelerometerData.Z);
        }
    }
}